06. PCA Demo
Cd13639 C1 L2 DEMO 2 V1
Simplifying Complex Datasets with PCA
Learn about Principal Component Analysis (PCA), a method to simplify complex datasets:
- PCA Purpose:
- Reduces high-dimensional and complex datasets.
- Combines highly correlated features.
- Demonstration:
- Uses an artificially generated two-feature dataset.
- The second feature is derived from the first to highlight correlation.
- Aims to reduce two features into one principal component.
- Preparation Steps:
- Import essential libraries: Pandas, Matplotlib, NumPy, and standard scaler for normalization.
- Standard scaler normalizes data by computing the z-score.
- Correlation Check:
- High correlation is observed, both features move similarly.
- PCA Process:
- PCA reduces dataset complexity while capturing most information.
- Apply the
PCA functionfrom scikit-learn. - Use
fitandtransformto convert data into PC representation.
- Understanding Explained Variance:
- Analyzes how much variation PCs explain.
- First component captures significant variance (e.g., 95%).
- Visualize variance via bar and cumulative charts.
- Goal:
- Achieve simplified datasets while preserving variances.
- Target around 90% explained variance for effective complexity reduction.